home *** CD-ROM | disk | FTP | other *** search
- '---------------------------------------------------------------------------
- '[PLAYCD.BAS] - v1.00 Public Domain by Denis Boyles. All Rights Reserved.
- '---------------------------------------------------------------------------
-
- ' This program is more or less identical in function to the CDPLAY program
- ' posted by Dave Shea. That is, it will supposedly play an AUDIO CD inserted
- ' into the CD-ROM drive of your computer.
-
- ' In doing this re-write, I have tried to "clean up" the code; making it
- ' easier to read and understand. However, for simplicity, I hard coded the
- ' starting sector and total sectors. The original started at sector #1 and
- ' played 300,000 sectors. This is what I used as well, but were coded into
- ' the SUB rather then being parameters.
- '
- ' (it eased the clean up, but by all means, change as desired)
-
- ' * IMPORTANT *
-
- ' This program is UNTESTED since, well, ok, I don't have a CD-ROM drive to
- ' test with! (what you say!? :) I have tried to follow the original program,
- ' so it should be no worse in functionality in that regard.
- '===========================================================================
- '
- ' Additional notes: Tested by Tika Carr
- '
- ' This program will NOT work in Windows! You have to run this in DOS only.
-
- '$INCLUDE: 'QB.BI'
-
- DECLARE SUB CDPlay (drive%)
- DECLARE SUB CDStop (drive%)
- DECLARE FUNCTION CDGetNumDrives% ()
- DECLARE FUNCTION CDGetVersion% ()
-
- CONST MULTIPLEX = &H2F 'DOS INT to access MSCDEX services
- CONST CDDRIVE = 4 '0 = A:, 1 = B:, 2 = C:,...
-
- CLS
- IF CDGetNumDrives = 0 THEN
- PRINT "ERROR: MSCDEX isn't installed or CD-ROM not hooked up properly!"
- END
- END IF
-
- CDVer% = CDGetVersion
- PRINT USING "MSCDEX v&_.& detected."; HEX$(CDVer% \ 256); HEX$(CDVer% MOD 256)
- PRINT : PRINT "Insert AUDIO CD into drive and press [ENTER] to play."
- WHILE INKEY$ <> CHR$(13): WEND
-
- PRINT : PRINT "Playing..."
- CALL CDPlay(CDDRIVE)
-
- PRINT : PRINT "Press [ESC] to stop playing."
- WHILE INKEY$ <> CHR$(27): WEND
-
- PRINT : PRINT "Stopped."
- CALL CDStop(CDDRIVE)
- END
-
- FUNCTION CDGetNumDrives%
- DIM regs AS RegType
-
- regs.ax = &H1500
- regs.bx = 0
- CALL INTERRUPT(MULTIPLEX, regs, regs)
-
- CDGetNumDrives% = regs.bx
- END FUNCTION
-
- FUNCTION CDGetVersion%
- DIM regs AS RegType
-
- regs.ax = &H150C
- CALL INTERRUPT(MULTIPLEX, regs, regs)
-
- CDGetVersion% = regs.bx
- END FUNCTION
-
- SUB CDPlay (drive%)
- DIM buffer%(64), regs AS RegTypeX
-
- buffer%(0) = 128
- buffer%(1) = 132
- buffer%(7) = 1 'StartSec& = 1
- buffer%(8) = 0
- buffer%(9) = -27680 'NumSec& = 300,000
- buffer%(10) = 4
-
- regs.ax = &H1510
- regs.bx = VARPTR(buffer%(0))
- regs.cx = drive%
- regs.es = VARSEG(buffer%(0))
- CALL INTERRUPTX(MULTIPLEX, regs, regs)
- END SUB
-
- SUB CDStop (drive%)
- DIM buffer%(64), regs AS RegTypeX
-
- buffer%(0) = 128
- buffer%(1) = 133
-
- regs.ax = &H1510
- regs.bx = VARPTR(buffer%(0))
- regs.cx = drive%
- regs.es = VARSEG(buffer%(0))
- CALL INTERRUPTX(MULTIPLEX, regs, regs)
- END SUB
-
-